package com.utils;

import org.junit.Test;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class SysOutFormat {

    @Test
    public void test() {
        String str = "{\"message\":\"excpetion: \\u670d\\u52a1\\u53c2\\u6570\\u7ec4\\u88c5\\u5931\\u8d25.param={\\\"env\\\": \\\"prepub-qa\\\", \\\"sourceEnv\\\": \\\"publish\\\", \\\"jobId\\\": 31441624, \\\"taskType\\\": \\\"BaichuanSceneRecognize\\\", \\\"paramTemplate\\\": \\\"http://hd-xmap.cn-zhangjiakou-d.oss.aliyun-inc.com/disk/evaluate/HQALGEva/prepub-verify/sample/e5151048ce61444bbe0b8b86ece8c23d/BaichuanSceneRecognition.json\\\", \\\"regionId\\\": \\\"H48F017017\\\", \\\"meshIds\\\": \\\"H481193201,H481193200,H481193199\\\", \\\"projectId\\\": 45270937, \\\"projectName\\\": \\\"H48F017017_45270935\\\", \\\"updateId\\\": \\\"45270935\\\", \\\"mapScheduleId\\\": {\\\"BaichuanSceneRecognize\\\": null, \\\"BaichuanSceneUnderstand\\\": null, \\\"sceneCrossUnderstand\\\": null, \\\"xmap-gt-change-detect\\\": null}} ex=\\u67e5\\u8be2job\\u53c2\\u6570\\u7ec4\\u88c5\\u670d\\u52a1\\u5931\\u8d25, ex=sdk invoke failed, sdk_name=xfaas-client, method_name=invoke, param_dict={'projectName': 'xmap-vision-evaluating-service', 'runnerName': 'jobTaskRunner', 'methodName': 'createRequest', 'env': 'prepub', 'args': [{'env': 'prepub-qa', 'sourceEnv': 'publish', 'jobId': 31441624, 'taskType': 'BaichuanSceneRecognize', 'paramTemplate': 'http://hd-xmap.cn-zhangjiakou-d.oss.aliyun-inc.com/disk/evaluate/HQALGEva/prepub-verify/sample/e5151048ce61444bbe0b8b86ece8c23d/BaichuanSceneRecognition.json', 'regionId': 'H48F017017', 'meshIds': 'H481193201,H481193200,H481193199', 'projectId': 45270937, 'projectName': 'H48F017017_45270935', 'updateId': '45270935', 'mapScheduleId': {'BaichuanSceneRecognize': None, 'BaichuanSceneUnderstand': None, 'sceneCrossUnderstand': None, 'xmap-gt-change-detect': None}}]}, unified_sdk_env=prepub, error=invoke sdk failed, sdk_name = xfaas-client, method_name = invoke, resp_dict = {'code': '-1', 'msg': '\\u6267\\u884c\\u76ee\\u6807\\u65b9\\u6cd5\\u5931\\u8d25 errorMsg=java.lang.RuntimeException: http \\u54cd\\u5e94\\u7801\\u4e3a500\\uff0curl=http://pre-fn-publish-xfaas-group-no47.alibaba-inc.com/fun-recource-no3011?runnerName=jobTaskRunner,body={\\\"args\\\":[{\\\"sourceEnv\\\":\\\"publish\\\",\\\"jobId\\\":31441624,\\\"paramTemplate\\\":\\\"http://hd-xmap.cn-zhangjiakou-d.oss.aliyun-inc.com/disk/evaluate/HQALGEva/prepub-verify/sample/e5151048ce61444bbe0b8b86ece8c23d/BaichuanSceneRecognition.json\\\",\\\"updateId\\\":\\\"45270935\\\",\\\"taskType\\\":\\\"BaichuanSceneRecognize\\\",\\\"regionId\\\":\\\"H48F017017\\\",\\\"mapScheduleId\\\":{},\\\"env\\\":\\\"prepub-qa\\\",\\\"projectName\\\":\\\"H48F017017_45270935\\\",\\\"projectId\\\":45270937,\\\"meshIds\\\":\\\"H481193201,H481193200,H481193199\\\"}],\\\"asynchronouInvok\\\":false,\\\"env\\\":\\\"prepub\\\",\\\"methodName\\\":\\\"createRequest\\\",\\\"parameterType\\\":[\\\"com.autonavi.amap.business.hq.entity.AlgJobTaskDTO\\\"],\\\"projectName\\\":\\\"xmap-vision-evaluating-service\\\",\\\"runnerName\\\":\\\"jobTaskRunner\\\"}";
        System.out.println(str);
    }

    @Test
    public void test2() {
        System.out.println(Long.reverse(22781801L << 1));
    }

    @Test
    public void test3() {
        String str = "{\"baseContextMap\":{},\"businessKey\":\"35169638\",\"callbackTianMaTag\":\"callback\",\"callbackTianMaTopic\":\"tianma-xmap-flow-center-callback_PREPUB\",\"collectCarType\":\"PandarXT16\",\"collectDate\":\"20220923\",\"contextMap\":{},\"createTime\":1683169300000,\"env\":\"prepub-qa\",\"flowBusinessKey\":\"35169638-Record008-35176063\",\"flowContext\":\"25421659181335#colZCheckCreateTask#25421659171335#xmap-flow-center\",\"jobDefinitionId\":1290,\"jobId\":22781801,\"jobResult\":{\"needCallBackKeyList\":[],\"resultMap\":{}},\"jobScopeType\":3,\"jobType\":\"liteColZCheckCreateTaskJob\",\"localExecuteAsync\":true,\"mtlId\":35176063,\"ng\":false,\"plateNumber\":\"AVZ273\",\"priority\":0,\"projectId\":35169638,\"projectName\":\"22Q3-20220923012854-GUANGZHOU-AVZ273-29737005\",\"projectRecordCount\":8,\"records\":[\"Record008\"],\"roadType\":1,\"sceneType\":\"default\",\"skip\":false,\"skipStore\":false,\"subBusinessKey\":\"35176063\",\"taskRunType\":\"wait_callback\",\"taskStartTime\":\"2023-07-27 18:24:28\",\"taskType\":\"\"}";
        System.out.println(str);
    }

    @Test
    public void test4() {
        String str = "41397064\n" +
                "41397065\n" +
                "41397066\n" +
                "41397067\n" +
                "41397070\n" +
                "41397071\n" +
                "41397072\n" +
                "41397073\n" +
                "41397074\n" +
                "41397078\n" +
                "41397079\n" +
                "41397080\n" +
                "41397081\n" +
                "41397082\n" +
                "41397083\n" +
                "41397085\n" +
                "41397086\n" +
                "41397087\n" +
                "41397088\n" +
                "41397089\n" +
                "41397091\n" +
                "41397092\n" +
                "41397093\n" +
                "41397094\n" +
                "41397095\n" +
                "41397096\n" +
                "41397102\n" +
                "41397103\n" +
                "41397104\n" +
                "41397105\n" +
                "41397106\n" +
                "41397107\n" +
                "41397108\n" +
                "41397109\n" +
                "41397110\n" +
                "41397111\n" +
                "41397112\n" +
                "41397113\n" +
                "41397114\n" +
                "41397115\n" +
                "41397116\n" +
                "41397117\n" +
                "41397121\n" +
                "41397122\n" +
                "41397123\n" +
                "41397124\n" +
                "41397125\n" +
                "41397126\n" +
                "41397127\n" +
                "41397128\n" +
                "41397129\n" +
                "41397130\n" +
                "41397131\n" +
                "41397132\n" +
                "41397135\n" +
                "41397136\n" +
                "41397137\n" +
                "41397138\n" +
                "41397139\n" +
                "41397140\n" +
                "41397141\n" +
                "41397144\n" +
                "41397145\n" +
                "41397146\n" +
                "41397147\n" +
                "41397148\n" +
                "41397149\n" +
                "41397150\n" +
                "41397151\n" +
                "41397152\n" +
                "41397155\n" +
                "41397156\n" +
                "41397157\n" +
                "41397158\n" +
                "41397159\n" +
                "41397160\n" +
                "41397161\n" +
                "41397164\n" +
                "41397165\n" +
                "41397166\n" +
                "41397167\n" +
                "41397168\n" +
                "41397169\n" +
                "41397170\n" +
                "41397171\n" +
                "41397172\n" +
                "41397173\n" +
                "41397174\n" +
                "41397175\n" +
                "41397176\n" +
                "41397177\n" +
                "41397178\n" +
                "41397179\n" +
                "41397182\n" +
                "41397183\n" +
                "41397184\n" +
                "41397185\n" +
                "41397186\n" +
                "41397187\n" +
                "41397190\n" +
                "41397191\n" +
                "41397192\n" +
                "41397195\n" +
                "41397196\n" +
                "41397197\n" +
                "41397198\n" +
                "41397199\n" +
                "41397200\n" +
                "41397201\n" +
                "41397202\n" +
                "41397203\n" +
                "41397204\n" +
                "41397205\n" +
                "41397209\n" +
                "41397210\n" +
                "41397213\n" +
                "41397214\n" +
                "41397215\n" +
                "41397251\n" +
                "41397252\n" +
                "41397253\n" +
                "41397254\n" +
                "41397298\n" +
                "41397299\n" +
                "41397300\n" +
                "41397301\n" +
                "41397302\n" +
                "41397303\n" +
                "41397304\n" +
                "41397305\n" +
                "41397306\n" +
                "41397307\n" +
                "41397390\n" +
                "41397391\n" +
                "41397441\n" +
                "41397442\n" +
                "41397443\n" +
                "41397444\n" +
                "41397500\n" +
                "41397501\n" +
                "41397502\n" +
                "41397503\n" +
                "41399462\n" +
                "41399463\n" +
                "41399464\n" +
                "41399465\n" +
                "41399466\n" +
                "41399467\n" +
                "41399468\n" +
                "41399469\n" +
                "41400580\n" +
                "41400581\n" +
                "41400582\n" +
                "41400583\n" +
                "41400584\n" +
                "41400585\n" +
                "41400586\n" +
                "41400587\n" +
                "41401860\n" +
                "41401861\n" +
                "41401862\n" +
                "41401863\n" +
                "41406932\n" +
                "41406933\n" +
                "41406934\n" +
                "41406935\n" +
                "41406936\n" +
                "41406937\n" +
                "41406938\n" +
                "41407292\n" +
                "41407293\n" +
                "41407294\n" +
                "41407295\n" +
                "41407296\n" +
                "41407297\n" +
                "41407298\n" +
                "41407299\n" +
                "41407300\n" +
                "41407301\n" +
                "41407302\n" +
                "41407303\n" +
                "41407304\n" +
                "41407305\n" +
                "41407306\n" +
                "41407386\n" +
                "41407393\n" +
                "41407394\n" +
                "41407395\n" +
                "41407396\n" +
                "41454013\n" +
                "41454014\n" +
                "41454015\n" +
                "41454016\n" +
                "41454017\n" +
                "41454018\n" +
                "41454019\n" +
                "41454020\n" +
                "41454021\n" +
                "41454022\n" +
                "41454023";
        str = str.replaceAll("\n", ",");

        String[] idArray = str.split(",");
        List<String> idList = Arrays.asList(idArray);

        int count = 0;
        StringBuilder sb = new StringBuilder();
        for (String idStr : idArray) {
            if (++count == 50) {
                count = 0;
                System.out.println(sb.substring(0, sb.length() - 1));
                System.out.println();
                sb = new StringBuilder();
            }
            sb.append(idStr).append(",");
        }
        if (count > 0) {
            System.out.println(sb.substring(0, sb.length() - 1));
        }
    }

}
